unit Map_P0;

interface

uses
  SysUtils, Classes, ADODB, DataEngine, Class_P0;

type
  TMap_P0 = class(TDataEngine)
  public
    function ReadDS(AADODst: TADODataSet): TBaseClass; override;
    function GetStrsIndex(ABaseClass: TBaseClass): string; override;

    function GetStrInsert: string; override;
    function GetStrUpdate: string; override;
    function GetStrDelete: string; override;
    procedure SetParameters(ABaseClass: TBaseClass); override;

    function GetP0(CodeA: string; P0StrsListA: TStringList): TP0;
  end;

implementation

{ TMap_P0 }

function TMap_P0.GetP0(CodeA: string; P0StrsListA: TStringList): TP0;
var
  I: Integer;
begin
  Result := nil;
  if CodeA = '' then Exit;
  for I := 0 to P0StrsListA.Count - 1 do
  begin
    if TP0(P0StrsListA.Objects[I]).DM = CodeA then
    begin
      Result := TP0(P0StrsListA.Objects[I]);
      Exit;
    end;
  end;
end;

function TMap_P0.GetStrDelete: string;
begin
  Result := '';
end;

function TMap_P0.GetStrInsert: string;
begin
  Result := '';
end;

function TMap_P0.GetStrsIndex(ABaseClass: TBaseClass): string;
begin
  Result := '';
end;

function TMap_P0.GetStrUpdate: string;
begin
  Result := '';
end;

function TMap_P0.ReadDS(AADODst: TADODataSet): TBaseClass;
begin
  Result := TP0.Create;
  with TP0(Result) do
  begin
    DM := AADODst.FieldByName('DM').AsString;
    MC := AADODst.FieldByName('MC').AsString;
    JC := AADODst.FieldByName('JC').AsString;
    SX := AADODst.FieldByName('SX').AsString;
    ID := AADODst.FieldByName('ID').AsString;
  end;
end;

procedure TMap_P0.SetParameters(ABaseClass: TBaseClass);
begin
  inherited;
end;

end.
